/*
 *The code is written by NaLi, All rights reserved.
 */
package com.nali.dal.statement.function;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @author gavin 
 * Created on 2011-4-8
 */
@Component
public class DataHandlerFactory implements ApplicationContextAware{
	private ApplicationContext applicationContext;
	
	
	@SuppressWarnings("unchecked")
	public DataHandler<Object> getDataHandler(String name) {
		try {
			return this.applicationContext.getBean(name, DataHandler.class);
		} catch (BeansException e) {
			return null;
		}
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		this.applicationContext = applicationContext;
	}
}

